package Demo02;

public class Test {
    public static void main01(String[] args) {
        System.out.println(mtd());
    }
    public static int mtd() {
        try {
            /*int[] arr = new int[10];
            System.out.println(arr[0]);*/
            return 0;
        } catch (NullPointerException e) {
            System.out.println("空指针异常");
        } finally {
            System.out.println("执行finally");
        }
        return 1;
    }

    public static void main(String[] args) {

    }
    public static void login(int num) throws numWrongException {
        if(num==1) {
            throw new numWrongException("数字错误");
        }
    }
    public static void set() {
        try {
            login(1);
        } catch (numWrongException e) {
            System.out.println("解决数字错误");
        } finally {
            System.out.println("清理资源");
        }
    }

}


class numWrongException extends Exception {
    public numWrongException(String str) {
        super(str);
    }
}
